package summer_vacation.lvchang.myyVacation;

/**
 * Created by Administrator on 2015/9/6.
 */
//百钱买百鸡问题：公鸡每只 5 元，母鸡每只 3 元，小鸡 3 只一元，问一百元买一百只鸡有几种买法。
public class Text30 {
    public static void main(String[] args) {
        int a = 0;
        int b = 0;
        double c = 0;
        int i = 0;
        for(a = 1; a <= 20; a++){
            for(b = 1; b <= 33; b++){
                for(c = 1; c <= 100; c++){
                    if(5 * a + 3 * b + c / 3 == 100 && a + b + c ==100){
                        i++;
                        int c1 = (int)c;
     System.out.print("第" + i +"种方法：公鸡" + a + "只，母鸡" + b + "只，小鸡" + c1 + "只");
      System.out.println("\n");
                    }
                }
            }
        }
    }
}

